<template>
  <div>
    <el-breadcrumb separator="/" separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{}">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>

    <el-card>
      <el-table :data="arr" border stripe :header-cell-style="{background:'#EEF1F6',color:'#606266'}" style="width: 100%">
        <el-table-column label="#" type='index' width="50px">
        </el-table-column>
        <el-table-column prop="authName" label="权限名称" >
        </el-table-column>
        <el-table-column prop="path" label="路径" >
        </el-table-column>
        <el-table-column  label="权限等级" >
          <template slot-scope="scope">
            <!-- {{scope.row}} -->
            <el-tag v-if='scope.row.level == 0'>一级权限</el-tag>
            <el-tag type='success' v-if='scope.row.level == 1'>二级权限</el-tag>
            <el-tag type='warning' v-if='scope.row.level == 2'>三级权限</el-tag>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script>
export default {
  data () {
    return {
      arr:[],
    }
  },
  methods: {
    async getData(){
      var {data:res} = await this.$http.get('rights/list');
      this.arr = res.data;
    }
  },
  created(){
    this.getData();
  }
};
</script>

<style>
.el-card {
  margin-top: 20px;
}
</style>